package dk.dashboardFP.panels.loggerPanel {
	import dk.dashboardFP.dfpLogger.DFPLogItem;
	import dk.dashboardFP.dfpLogger.view.LogItemView;
	import dk.dashboardFP.dfpLogger.view.LogItemViewEvent;
	import dk.dashboardFP.elements.button.ButtonElement;
	import dk.dashboardFP.elements.button.SmallButtonElement;
	import dk.dashboardFP.utils.describeObjectUtil.DescribeObjectUtil;
	import dk.dashboardFP.interactionElementFramwork.buttons.ButtonEvent;

	/**
	 * @author josef
	 */
	public class DataLogItemView extends LogItemView {
		private var _oDFPButton : ButtonElement;

		public function DataLogItemView(oDFPLogItem : DFPLogItem) {
			super(oDFPLogItem);
		}

		override protected function setupElements() : void {
			super.setupElements();
			
			//:::::::
			// set object inspect button 
			_oDFPButton=new SmallButtonElement(_oDFPLogItem, DescribeObjectUtil.getObjectDescription(_oDFPLogItem.oData).className);
			addChild(_oDFPButton);
			
			_oDFPButton.oButton.addEventListener(ButtonEvent.CLICKED, onButtonClick, false, 0, true);
			
			_oDFPButton.x = _doMessageLabel.x-2;
			updateHeight();
		}

		private function onButtonClick(event : ButtonEvent) : void {
			dispatchEvent(new LogItemViewEvent(LogItemViewEvent.REQUEST_OBJECT_INTROSPECT, true));
		}

		
		override protected function updateHeight() : void {
			_oDFPButton.y = super.get_nHeight()-7;
			super.updateHeight();
		}

		override protected function get_nHeight() : Number {
			return _oDFPButton.y + _oDFPButton.height+8;
		}
	}
}
